binSearch=function(arr,data){
    let head=0
    let len=arr.length
    let last=len-1
    while(head<=last){
        mid=Math.floor((head+last)/2)
        if(arr[mid]<data){
            head=mid+1
        }
        if(arr[mid]>data){
            last=mid-1
        }
        if(arr[mid]==data){
            console.log(mid)
            return mid
        }
    }
    console.log(-1)
    return -1
}
binSearch([1,2,3,4,5,6,7],99)
